/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cse308.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Aaron
 */
@Embeddable
public class CourseofferingPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(nullable = false, length = 20)
    private String course;
    @Basic(optional = false)
    @NotNull
    @Column(nullable = false)
    private int section;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 10)
    @Column(nullable = false, length = 10)
    private String semester;

    public CourseofferingPK() {
    }

    public CourseofferingPK(String course, int section, String semester) {
        this.course = course;
        this.section = section;
        this.semester = semester;
    }

    public String getCourse() {
        return course;
    }

    public void setCourse(String course) {
        this.course = course;
    }

    public int getSection() {
        return section;
    }

    public void setSection(int section) {
        this.section = section;
    }

    public String getSemester() {
        return semester;
    }

    public void setSemester(String semester) {
        this.semester = semester;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (course != null ? course.hashCode() : 0);
        hash += (int) section;
        hash += (semester != null ? semester.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CourseofferingPK)) {
            return false;
        }
        CourseofferingPK other = (CourseofferingPK) object;
        if ((this.course == null && other.course != null) || (this.course != null && !this.course.equals(other.course))) {
            return false;
        }
        if (this.section != other.section) {
            return false;
        }
        if ((this.semester == null && other.semester != null) || (this.semester != null && !this.semester.equals(other.semester))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cse308.entities.CourseofferingPK[ course=" + course + ", section=" + section + ", semester=" + semester + " ]";
    }
    
}
